#define  _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	int n = 0;
	scanf("%d", &n);
    int a[10][10] = { 0 };
	int i = 0;
	int j = 0;
    int k = 1;
    int x = 0;
    int y = 0;
    int off = 1;
    for(int s=0;s<n/2;s++)
    {
        for (j = y; j < n-off; j++)
        {
            a[x][j] = k++;
        }
        for (i = y; i < n-off; i++)
        {
            a[i][j] = k++;
        }
        for ( ; j > x; j--)
        {
            a[i][j] = k++;
        }
        for (; i > y; i--)
        {
            a[i][j] = k++;
        }
        x++;
        y++;
        off++;
    }
    if (n % 2 == 1)
        a[x][y] = k;
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < n; j++)
		{
			printf("%2d ", a[i][j]);
		}
		printf("\n");
	}
	return 0;
}